<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<style type="text/css">
	#table1{
		width:75%;
		border:1px solid #ccc;
		margin-left:20px;
		text-align:center;
	}
	#table-project-1,#table-project-2,#table-project-3{
		width:90%;
		border:1px solid #ccc;
		margin-left:20px;
		text-align:center;
	}
	#table1 th,#table-project-1 th,#table-project-2 th,#table-project-3 th{
	 height:30px;
	 border: 1px solid #ccc;
	}
	#table1 th,#table1 td,#table-project-1 td,#table-project-2 td,#table-project-3 td{
	 height:35px;
	 border: 1px solid #ccc;
	}
	.t-font{
		font-weight:bolder;
	}
	#count-1,#count-2,#count-3{
		margin-top:20px;
		margin-bottom:20px;
	}
	.total{
		font-size:14px;
		font-weight:bolder;
	}
	#table1,#table-project-3,#table-project-2,#table-project-1{font-size:14px;}
</style>
</head>
<body>
<ul class="nav nav-tabs" style="margin:0 4px 4px 4px;">
		<c:forEach items="${list}" var="menu"  varStatus="idxStatus">
			<li class="${menu.tag eq tag?'active':''}">
				<a href="${ctx}/${menu.href}${fn:indexOf(menu.href, '?') eq -1?'?':'&'}left=${fns:encodeParamUrl(left)}&top=${fns:encodeParamUrl(top)}&parentId=${fns:encodeParamUrl(parentId)}&LId=${fns:encodeParamUrl(LId)}&filter_EQS_tag=${menu.tag}">
					<i class="icon icon-list" style="margin-right:10px"></i><span>${menu.name}</span>
				</a>
			</li>
		</c:forEach>
	</ul>
	<div style="margin:0 4px;" id="count">
		<div id="count-all">
	 		<span style="font-size:14px;font-weight:bolder;padding-left:15px;">工程总览:</span>
	 		<hr>
	 	</div>
		<div id="count-1">
	 		<span style="font-size:14px;font-weight:bolder;padding-left:15px;">安保工程汇总表:</span>
	 		<hr>
	 	</div>
		<div id="count-2">
	 		<span style="font-size:14px;font-weight:bolder;padding-left:15px;">危桥改造汇总表:</span>
	 		<hr>
	 	</div>
		<div id="count-3">
	 		<span style="font-size:14px;font-weight:bolder;padding-left:15px;">灾害防治汇总表:</span>
	 		<hr>
	 	</div>
	</div>
	
	<script type="text/javascript">
	$(document).ready(function(){
			$.ajax({
				type : "POST",
				dataType : "json",
				url : "${ctx}/reconstruct/count.do",
				success : function(data) {
					getTotalTable(data[0]);
					var title ;
					for(var i =1;i<data.length;i++){
						if(i==1){
							title="安保工程";
						}else if(i==2){
							title="危桥改造";
						}else{
							title="灾害防治";
						}
						getProjectTable(data[i],title,i);
					}
				},
				error : function(data) {
				}
			});
	});
	
	function getTotalTable(data){
		var content ="<table id='table1'><tr><th>分类</th><th>计数（项）</th><th>完成数（项）</th><th>完成率（%）</th>";
		for(var i = 0; i<data.length;i++){
			content+="<tr><td class='t-font'>"+data[i].name+"</td><td>"+data[i].all+"</td><td>"+data[i].finished+"</td><td>"+data[i].rate+"%</td></tr>";
		}
	   content+="</table>";
	   $('#count-all').append(content);
	}
	
	function getProjectTable(data,title,i){
		var content = "<table id='table-project-"+i+"'>"+
						"<tr>"+
						"<th colspan='9'>深圳市路网结构改造工程（"+title+"）汇总表</th>"+
					"</tr>"+
					"<tr>"+
						"<th rowspan='2'>年　　份</th>"+
						"<th colspan='4'>项目完成情况</th>"+
						"<th colspan='4'>配套资金情况</th>"+
					"</tr>"+
					"<tr>"+
						"<th>项目数（项）</th>"+
						"<th>完成数（项）</th>"+
						"<th>未完成数（项）</th>"+
						"<th>完成率（%）</th>"+
						"<th>总投资（万元）</th>"+
						"<th>部补助（万元）</th>"+
						"<th>省区市自筹（万元）</th>"+
						"<th>配套资金比例（%）</th>"+
					"</tr>";
		for(var j = 0;j<data.length;j++){
			if(j==(data.length-1)){
				content+="<tr class='total'>";
			}else{
				content+="<tr>";
			}
			content+="<td class='t-font'>"+data[j].year+"</td><td>"+data[j].all+"</td><td>"+data[j].finished+"</td><td>"+data[j].spare+"</td><td>"+data[j].finishRate+"%</td>"+
			"<td>"+data[j].total+"</td><td>"+data[j].subsidy+"</td><td>"+data[j].selfRaised+"</td><td>"+data[j].rate+"%</td></tr>";
		}
		 content+="</table>";
		$('#count-'+i).append(content);
	}
	</script>
</body>
</html>